//
//  CSYEmoticonModel.swift
//  CSYEmoticonKeyboard__Test
//
//  Created by 姚彦兆 on 15/11/21.
//  Copyright © 2015年 姚彦兆. All rights reserved.
//

import UIKit

class CSYEmoticonModel: NSObject {

    //表情模型的属性
    
    var id : String?

    
    //图片昵称
    var chs : String?
    
    //图片名称
    var png : String?
    
    //图片路径
    var pngPath : String? {
    
        if let idPath : String = id , pngPath : String = png {
        
            let path : String = NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + "\(idPath)/" + "\(pngPath)"
            
            return path
        
        }
        
        return nil
    
    }
    
    
    var code : String?
    
    //默认图片扫描字符串
    
    var defaultEmoticon : String? {
        
        if let str : String = code?.systemEmoticon{
        
            return str
    
        }
        
        return nil
    }
    
    
    //定义是否为删除按钮的Bool变量

    var isRemove : Bool = false
    
    //定义是否为空的按钮的Bool变量
    
    var isEmpty : Bool = false
    
    init(isRemove : Bool) {
    
        self.isRemove = isRemove
        
        super.init()
        
    }
    
    init(isEmpty : Bool) {
    
        self.isEmpty = isEmpty
    
        super.init()
        
    }
    
    init(id : String , emoticonDict : [String : AnyObject]) {
        
        self.id = id
        
        super.init()
        
        setValuesForKeysWithDictionary(emoticonDict)
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description : String {
    
        let keys = ["chs","code","png"]
        
        return dictionaryWithValuesForKeys(keys).description
    
    }
    
}
